package com.huaxin.hxmoduleworkorder.dto.request;

import com.huaxin.hxmoduleworkorder.common.annotation.validation.ValidMaintenanceOrderOperatorRole;
import com.huaxin.hxmoduleworkorder.common.annotation.validation.ValidOrderType;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Data;

import java.util.List;

/**
 * 新增客户评价请求 DTO
 * <p>
 * 对应实体类：CustomerEvaluation
 * 用于接收前端提交的客户评价数据。
 * 所有字段命名与实体类完全一致，确保映射准确。
 * </p>
 *
 * @author [你的名字或团队]
 * @since 2025-09-02
 */
@Data
public class CustomerEvaluationCreateReqDTO {
    @Schema(description = "工单类型", example = "maintenance")
    @NotNull
    @ValidOrderType
    private String orderType;

    @Schema(description = "工单ID，关联维修工单", example = "mnt_order_001")
    @NotBlank(message = "工单ID不能为空")
    private String maintenanceOrderId;

    @Schema(description = "工单标题", example = "2023年1月1日-2023年1月31日")
    @NotNull(message = "工单标题不能为空")
    private String orderTitle;

    @Schema(description = "客户ID，标识评价人", example = "c1001")
    @NotBlank(message = "客户ID不能为空")
    private String customerId;

    @Schema(description = "客户名称", example = "海天酱油股份有限公司")
    @NotNull(message = "客户名称不能为空")
    private String customerName;

    @Schema(description = "客户手机号码", example = "13800000000")
    @NotNull(message = "客户手机号码不能为空")
    private String customerPhone;

    @Schema(description = "评分：1-5星", example = "5")
    @NotNull(message = "评分不能为空")
    @Min(value = 1, message = "评分不能低于1星")
    @Max(value = 5, message = "评分不能高于5星")
    private Integer rating;

    @Schema(description = "评价内容，客户反馈", example = "服务专业，响应迅速")
    @Size(max = 1000, message = "评价内容长度不能超过1000个字符")
    private String comment;

    @Schema(description = "被评价的电工ID列表", example = "[\"e1001\", \"e1002\"]")
    @NotNull(message = "被评价的电工ID列表不能为空")
    private List<String> electricianIds;

    @Schema(description = "是否匿名评价：0-否，1-是", example = "0")
    @NotNull(message = "是否匿名评价不能为空")
    private Integer isAnonymous;

    @Schema(description = "评价人角色，允许值：customer,admin,electrician", example = "customer")
    @ValidMaintenanceOrderOperatorRole
    private String evaluatorRole;
}